- /* sdcexp1.cpp by K.Tsuru */
- // function ID 3521 DRADIX, constant
- /*************************
- base of natural logarithm exp(1).
- In header "snmath.h" the function prototype is given below
- --------
- SDouble E(const SDouble* e = NULL, SDouble (*pfCalcFunc)() = SNE);
- --------
- Remade at version 2.30.
- **************************/
- #ifndef SN_H
- #include "sn.h"
- #endif
- static SDouble* exp1 = NULL; //keep in the static memory
- static uint exp1Size = 0;
-
- uint ESize() { return exp1Size; }
-
- void EFree(){ //free the momory of exp1
- if(exp1Size == 0) return;
- delete exp1; exp1 = NULL; exp1Size = 0;
- }
- SDouble E(const SDouble* userE, SDouble (*pfCalcFunc)()){
- if(exp1 == NULL) exp1 = new SDouble;
- uint curMaxSize = exp1->MaxSize(); // current max size
- if( exp1Size < curMaxSize ){
- #if UsesSNConstantFile
- if(userE == NULL){ //called by default argument
- int enough;
- /**********************************************************************************
- UpdateConstantFile() recursively calls this function E() via SetConstByFile()
- of which userE != NULL, then does not come here and processing below has been
- done.
- **********************************************************************************/
- enough = UpdateConstantFile(E_FILE, E, pfCalcFunc, curMaxSize);
- if(enough != NO_SNC_FILE) return *exp1;
- }
- #endif
- exp1->ShowMessage("Evaluating E() now.....");
- EntryConst(userE, exp1, pfCalcFunc, &exp1Size);
- exp1->ShowMessage(" Finished.\n"); // ver. 2.17
-
- exp1Size = curMaxSize;
- }
- return *exp1;
- }
sdcexp1.cpp : last modifiled at 2017/06/24 10:41:10(1,557 bytes)
created at 2017/10/07 10:21:15
The creation time of this html file is 2017/10/07 10:30:03 (Sat Oct 07 10:30:03 2017).